package com.service;

import com.mapper.FinishedProductMapper;
import com.pojo.FinishedProductInfo;
import com.service.iter.IFinishedProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 成品服务impl
 *
 * @author admin
 * @date 2023/06/20
 */
@Service
@Transactional
public class FinishedProductServiceImpl implements IFinishedProductService {
    /**
     * 成品映射器
     */
    @Autowired
    public FinishedProductMapper finishedProductMapper;

    /**
     * 完成产品信息
     *
     * @return {@link List}<{@link FinishedProductInfo}>
     */
    @Override
    public List<FinishedProductInfo> getFinishedProductInfo() {
        return finishedProductMapper.getFinishedProductInfo();
    }

    @Override
    public FinishedProductInfo queryFinishProductByCode(Long productId) {
        return finishedProductMapper.queryFinishProductByCode(productId);
    }

    @Override
    public int updateActual(String batchNumber, Long finishedProductActual) {
        return finishedProductMapper.updateActual(batchNumber,finishedProductActual);

    }

//    @Override
//    public int updateBatch(String random,Long finishedProductId) {
//        System.out.println("11111111");
//        System.out.println(random+finishedProductId);
//        System.out.println("11111111");
//        return finishedProductMapper.updateBatch(random,finishedProductId);
//    }

    @Override
    public int updateCause(String batchNumber, Long finishedProductActual, String cause) {
        return finishedProductMapper.updateCause(batchNumber,finishedProductActual,cause);
    }}
